<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>后台版本数据管理</title>
    <link rel="stylesheet" href="Public/Plug/layui/css/layui.css" media="all" />
</head>

<body>
<div class="admin-main">
    <div style="position: relative;" class="layui-row">
        <div style="margin: 10px 0px 0px 20px;" class="layui-row">
            <div class="layui-col-md8">
                <div style="font-size: 18px;font-weight: bold;">版本列表</div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>版本号</th>
                        <th>当前版本</th>
                        <th>状态</th>
                        <th>创建时间</th>
                        <th>更新时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach $versionInfo as $val}
                        <tr>
                            <td>{$val.versionNumber}</td>
                            <td>{$val.isCurrent}</td>
                            <td>{$val.status}</td>
                            <td>{$val.createTime}</td>
                            <td>{$val.updateTime}</td>
                            <td>
                                <button class="layui-btn switch" lay-data="{$val.id}">切换</button>
                            </td>
                        </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="Public/Plug/layui/layui.js"></script>
    <script>
        layui.use(['layer','element','form'], function() {
            var	$ = layui.jquery,
                element = layui.element,
                form = layui.form;

            //切换版本
            $('.switch').click(function(){
                    var val = $(this).attr("lay-data");
                    var url = "{U('Version/switchVersion')}";
                    $.get(url,{ id:val },function (data) {
                        layer.open({
                            title:'切换版本',
                            type: 1,
                            skin: 'layui-layer-rim', //加上边框
                            area: ['500px'], //宽高
                            content: data,
                        });
                    });
            });
        });
    </script>
</body>

</html>